<template>
    <div class="addToClass">
        <el-form-item label="班级学员：" :label-width="formLabelWidth">
            <el-button plain  @click="addToBtn">添加学员进班级</el-button>
        </el-form-item>
        <!-- 内层添加学员进班级 -->
        <el-dialog
            title="添加学员进班级"
            width="80%"
            :modal=false
            :visible.sync="innerVisible"
            :close-on-click-modal=false
            append-to-body>
            <div class="operate_inputs">
                <el-form :inline="true" :model="formInline" class="demo-form-inline">
                    <el-form-item label="学员姓名:">
                        <el-input v-model="formInline.stuname"></el-input>
                    </el-form-item>
                    <el-form-item label="学员账号:">
                        <el-input v-model="formInline.stuId"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button class="search_btn" type="primary" @click="searchStu"><i class="el-icon-search"></i>查询</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <el-table
                :data="memberList"
                stripe 
                size="mini"
                border resizable
                style="width: 100%"
                max-height="418">
                    <el-table-column
                        label="学员账号"
                        prop="username"
                        :align="align"
                        :width="columWidth">
                    </el-table-column>
                    <el-table-column
                        label="学员姓名"
                        prop="nickname"
                        :align="align"
                        :width="columWidth">
                    </el-table-column>
                    <el-table-column
                        label="学员年龄"
                        prop="memberdetail.age"
                        :align="align"
                        :width="columWidth">
                    </el-table-column> 
                    <!-- <el-table-column
                        label="学员性别"
                        prop="memberdetail.gender"
                        :align="align"
                        :width="columWidth">
                    </el-table-column> -->
                    <el-table-column label="学员性别" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row.memberdetail.gender==1?'男':'女'}} </template>
                    </el-table-column>
                    <el-table-column
                        label="学员状态"
                        prop="attrinfo.attriname"
                        :align="align"
                        :width="columWidth">
                    </el-table-column>
                    <el-table-column
                        label="录入人"
                        prop="agentAddPersonName"
                        :align="align"
                        :width="columWidth">
                    </el-table-column>-->
                    <el-table-column label="注册时间" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row.regdate | transData}} </template>
                    </el-table-column>             
                    <el-table-column 
                        fixed="right" 
                        :align="align"
                        min-width="200"
                        label="操作">
                        <template slot-scope="scope">
                            <el-button
                                size="mini"
                                v-if='ifJoin(scope.row.userid)'
                                @click="submitAdd(scope.row.userid)">加入班级</el-button>
                            <el-button
                                size="mini"
                                v-if='!ifJoin(scope.row.userid)'
                                @click='toMove(scope.row.userid)'>已添加</el-button>
                            <el-button
                                size="mini"
                                type="info" plain
                                @click="getFile(scope.row.userid,scope.row.ischild)">档案</el-button>
                        </template>
                    </el-table-column>
            </el-table>

            <div class="page_block2">
                <el-pagination
                    background
                    @current-change="handleCurrentChange"
                    :current-page.sync="currentPage"
                    :page-size="page_size"
                    small
                    layout="prev, pager, next, jumper"
                    :total="totalCount">
                </el-pagination>
            </div>

            <div>
                <el-dialog title="查看少儿学员资料" 
                    :close-on-click-modal=false 
                    v-if="ifchild" 
                    :modal=false
                    :visible.sync="dialogFormVisibleda">
                    <el-form :model="form">
                        <el-form-item label-width="80px">
                            <div class="member_info">学员信息</div>
                        </el-form-item>
                        <el-form-item label="昵称：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.nickname"></el-input>
                        </el-form-item>
                        <el-form-item label="手机号：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.mobile"></el-input>
                        </el-form-item>
                        <el-form-item label="真实姓名：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.fullname"></el-input>
                        </el-form-item>
                        <el-form-item label="发送信息给学员：" :label-width="formLabelWidth">
                            <el-radio-group disabled v-model="form.sendmail">
                                <el-radio label=1>是</el-radio>
                                <el-radio label=0>否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="QQ：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.qq"></el-input>
                        </el-form-item>
                        <el-form-item label="SKype：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.skypenum" ></el-input>
                        </el-form-item>
                        <el-form-item label="Email：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.email"></el-input>
                        </el-form-item>
                        <el-form-item label="性别：" :label-width="formLabelWidth">
                            <el-radio-group  disabled v-model="form.gender">
                                <el-radio label=1>男</el-radio>
                                <el-radio label=0>女</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="出生日期：" :label-width="formLabelWidth">
                            <div class="block">
                                <el-date-picker
                                v-model="form.birthday"
                                type="date"
                                disabled
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                                </el-date-picker>
                            </div>
                        </el-form-item>
                        <el-form-item label="喜欢的动画片或玩具：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.toycartoon"></el-input>
                        </el-form-item>
                        <el-form-item label="所在年级：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.shoolPeriod" @change='getPeriod' placeholder="选择学年" class="divided_3">
                                <el-option 
                                v-for="(sp,a) in childData.shoolperiod"
                                :key="a" :label="sp.attriname" 
                                :value="sp.attriid"></el-option>
                            </el-select>
                            <el-select disabled v-model="form.grade" placeholder="选择年级" class="divided_3">
                                <el-option v-for="(gradeitem,gd) in grade_lists" :key='gd' :label="gradeitem" :value="gd"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="性格特点：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.character" placeholder="选择性格">
                                <el-option 
                                v-for="(childcc,b) in childData.childcharacters"
                                :key="b" :label="childcc.attriname" :value="childcc.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="礼品邮寄地址：" :label-width="formLabelWidth">
                            <el-cascader
                                size="large"
                                disabled
                                :options="options"
                                v-model="form.address"
                                @change="handleChange">
                            </el-cascader>
                            <el-input v-model="form.giftAddr" class="divided_200"></el-input>
                        </el-form-item>
                        <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                            <el-checkbox-group disabled v-model="form.studyfrom">
                                <el-checkbox 
                                v-for="(studyf,d) in childData.studyfrom"
                                :key="d" :label="studyf.attriid">{{studyf.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label-width="80px">
                            <div class="member_info">家庭信息</div>
                        </el-form-item>
                        <el-form-item label-width="80px">
                            <el-tag type="info">父亲信息</el-tag>
                        </el-form-item>
                        <el-form-item label="姓名：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.dadname"></el-input>
                        </el-form-item>
                        <el-form-item label="手机号：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.dadmobile"></el-input>
                        </el-form-item>
                        <el-form-item label="年龄：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.dadage"></el-input>
                        </el-form-item>
                        <el-form-item label="职业性质：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.dadjobs" placeholder="选择父亲职业">
                                <el-option 
                                v-for="(dadjob,e) in childData.jobs"
                                :key="e" :label="dadjob.attriname" :value="dadjob.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label-width="80px">
                            <el-tag type="info">母亲信息</el-tag>
                        </el-form-item>
                        <el-form-item label="姓名：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.mumname"></el-input>
                        </el-form-item>
                        <el-form-item label="手机号：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.mummobile"></el-input>
                        </el-form-item>
                        <el-form-item label="年龄：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.mumage"></el-input>
                        </el-form-item>
                        <el-form-item label="职业性质：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.mumjob" placeholder="选择母亲职业">
                                <el-option 
                                v-for="(mumjob,f) in childData.jobs"
                                :key="f" :label="mumjob.attriname" :value="mumjob.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="家庭收入：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.familyincome" placeholder="请选择">
                                <el-option 
                                v-for="(fain,g) in childData.familyincomes"
                                :key="g" :label="fain.attriname" :value="fain.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否已经开始学习英语：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.alreadystudy">
                                <el-radio label=1>是</el-radio>
                                <el-radio label=0>否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item v-if='form.alreadystudy==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.studytime"></el-input>
                        </el-form-item>
                        <el-form-item v-if='form.alreadystudy==1?true:false' label="学习英语以哪种方式开始：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.stratway">
                                <el-radio 
                                v-for="(starw,h) in childData.startways"
                                :key="h" :label="starw.attriid">{{starw.attriname}}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item v-if='form.alreadystudy==1?true:false' label="是否接触过外教课程：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.withforeign">
                                <el-radio label=1>是</el-radio>
                                <el-radio label=0>否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item v-if='form.withforeign==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.foreigntime"></el-input>
                        </el-form-item>
                        <el-form-item label="就读学校：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.schoolname"></el-input>
                        </el-form-item>
                        <el-form-item v-if='form.alreadystudy==1?true:false' label="孩子在校的英语成绩排名：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.englishrank" placeholder="选择排名">
                                <el-option 
                                v-for="(enrank,i) in childData.englishrank"
                                :key="i" :label="enrank.attriname" :value="enrank.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="孩子目前英语水平：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.englishlevel" placeholder="请选择">
                                <el-option 
                                v-for="(enlevel,j) in childData.englislevel"
                                :key="j" :label="enlevel.attriname" :value="enlevel.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="对孩子学习英语的期望：" :label-width="formLabelWidth">
                            <el-checkbox-group disabled v-model="form.expects">
                                <el-checkbox v-for="(expec,k) in childData.expects" :key="k" :label="expec.attriid" name="expects">{{expec.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="更希望孩子提升哪些方面：" :label-width="formLabelWidth">
                            <el-checkbox-group disabled v-model="form.improvefields">
                                <el-checkbox v-for="(impf,l) in childData.improvefields" :key="l" :label="impf.attriid" name="improvefields">{{impf.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="选择机构时首选考虑因素：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.considerfield">
                                <el-radio v-for="(consfi,m) in childData.considerfields" :key="m" :label="consfi.attriid">{{consfi.attriname}}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="每周预计投入学习时间：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.weekTime">
                                <el-radio v-for="(weekt,n) in childData.weektime" :key="n" :label="weekt.attriid">{{weekt.attriname}}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="适合孩子的上课时间：" :label-width="formLabelWidth">
                            <el-checkbox-group disabled v-model="form.suitabletime">
                                <el-checkbox v-for="(suitt,o) in childData.suitabletime" :key="o" :label="suitt.attriid" name="suitabletime">{{suitt.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="每月孩子学习英语的预算：" :label-width="formLabelWidth">
                            <el-radio-group disabled  v-model="form.monthbudget">
                                <el-radio ref="ref" v-for="(monthb,p) in childData.monthbudget" :key="p" :label="monthb.attriid">{{monthb.attriname}}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.finishtime" placeholder="选择时间">
                                <el-option v-for="(studyshi,q) in childData.studyshijian" :key="q" :label="studyshi.attriname" :value="studyshi.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="预算：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.budget" placeholder="选择预算">
                                <el-option v-for="(studymon,r) in childData.studymoney" :key="r" :label="studymon.attriname" :value="studymon.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.appeal"></el-input>
                        </el-form-item>
                        <!-- <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.firstpay" disabled></el-input>
                        </el-form-item> -->
                        <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.teachernote"></el-input>
                        </el-form-item>
                        <el-form-item label="学员状态：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.status" placeholder="选择状态">
                                <el-option v-for="(membersta,s) in childData.memberStatusList" :key="s" :label="membersta.attriname" :value="membersta.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-form>
                    <!-- 回访记录 -->
                    <el-tag  class='recordStyle' type="info">回访记录</el-tag>
                    <el-table
                        :data="gotRecord"
                        stripe 
                        size="mini"
                        border resizable
                        style="width: 100%;margin-left:40px;"
                        max-height="656">
                        <el-table-column label="回访结果" :align="align" :width="columWidth2">
                            <template slot-scope="scope">{{scope.row.lev1}} {{scope.row.lev2}} {{scope.row.lev3}}</template>
                        </el-table-column>
                        <el-table-column label="回访内容" :align="align" :width="columWidth2">
                            <template slot-scope="scope">{{scope.row.content}}</template>
                        </el-table-column>
                        <el-table-column label="回访人" :align="align" :width="columWidth">
                            <template slot-scope="scope">{{scope.row.agent ? scope.row.agent.realname:''}}</template>
                        </el-table-column>
                        <el-table-column label="回访时间" :align="align" :width="columWidth">
                            <template slot-scope="scope">{{scope.row._time}}</template>
                        </el-table-column>
                    </el-table> 
                    <div slot="footer" class="dialog-footer">
                        <el-button class="dialog_close" @click="dialogFormVisibleda = false">关闭</el-button>
                    </div>
                </el-dialog>
            
                <el-dialog title="查看成人学员信息" 
                    :close-on-click-modal=false 
                    v-if="!ifchild" 
                    :modal=false
                    :visible.sync="dialogFormVisibleda">
                    <el-form :model="form" >
                        <el-form-item label="登录账号：" :label-width="formLabelWidth">
                            <el-input v-model="form.username" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="注册时间：" :label-width="formLabelWidth">
                            <el-input v-model="form.regdate" disabled></el-input>
                        </el-form-item>
                            <el-form-item label="上次登陆时间：" :label-width="formLabelWidth">
                            <el-input v-model="form.lastdate" disabled></el-input>
                        </el-form-item>
                            <el-form-item label="登录次数：" :label-width="formLabelWidth">
                            <el-input v-model="form.loginnum" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="昵称：" :label-width="formLabelWidth">
                            <el-input v-model="form.nickname" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="真实姓名：" :label-width="formLabelWidth">
                            <el-input v-model="form.fullname" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="手机：" :label-width="formLabelWidth">
                            <el-input v-model="form.mobile" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="Email：" :label-width="formLabelWidth">
                            <el-input v-model="form.email" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="性别：" :label-width="formLabelWidth">
                            <el-radio-group  v-model="form.gender" disabled>
                                <el-radio label=1>男</el-radio>
                                <el-radio label=0>女</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="大学：" :label-width="formLabelWidth">
                            <el-input v-model="form.daxue" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="专业：" :label-width="formLabelWidth">
                            <el-input v-model="form.zhuanye" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="公司：" :label-width="formLabelWidth">
                            <el-input v-model="form.gongsi" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="行业：" placeholder="选择一项行业" :label-width="formLabelWidth">
                            <el-select v-model="form.job" disabled>
                                <el-option v-for="(jobitem,c) in fromLabel.job" :key="c" :label="jobitem.attriname" :value="jobitem.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="职位：" :label-width="formLabelWidth">
                            <el-input v-model="form.zhiwei" disabled></el-input>
                        </el-form-item>
                        
                        <el-form-item label="公司网站：" :label-width="formLabelWidth">
                            <el-input v-model="form.gongsiwangzhi" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="公司电话：" :label-width="formLabelWidth">
                            <el-input v-model="form.gongsidianhua" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="公司人事联系人：" :label-width="formLabelWidth">
                            <el-input v-model="form.lianxiren" disabled class="divided_2"></el-input>
                        </el-form-item>
                        <el-form-item label="qq" :label-width="formLabelWidth">
                            <el-input v-model="form.qq" disabled></el-input>
                        </el-form-item>  
                        <el-form-item label="SKype：" :label-width="formLabelWidth">
                            <el-input v-model="form.skypenum" disabled></el-input>
                        </el-form-item>  
                        <el-form-item label="分类：" :label-width="formLabelWidth">
                            <el-radio-group  disabled v-model="form.isfirststudy">
                                <el-radio label=0>第一次学习</el-radio>
                                <el-radio label=1>上过体验课</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="年龄段：" placeholder="选取年龄段" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.age">
                                <el-option v-for="(ageitem,a) in fromLabel.age" :key="a" :label="ageitem.attriname" :value="ageitem.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                            <el-checkbox-group disabled v-model="form.studyfrom">
                                <el-checkbox v-for="(studyfitem,g) in fromLabel.studyfrom" :key="g" :label="studyfitem.attriid" name="studyfrom">{{studyfitem.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="英语水平：" placeholder="选取英语水平" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.studylevel">
                                <el-option v-for="(slitem,b) in fromLabel.studylevel" :key="b" :label="slitem.attriname" :value="slitem.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="英语分数：" :label-width="formLabelWidth">
                            <el-input v-model="form.highscore" disabled class="divided_2"></el-input>
                        </el-form-item>                     
                        <el-form-item :label-width="formLabelWidth" label="学习英语第一目标-课程：">
                            <el-checkbox-group disabled v-model="form.wanttostudy">
                                <el-checkbox v-for="(ccitem,d) in fromLabel.curriculumType" :key="d" :label="ccitem.id" name="curriculumType">{{ccitem.title}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item :label-width="formLabelWidth" label="学习英语第二目标-方面：">
                            <el-checkbox-group disabled v-model="form.studyhigh">
                                <el-checkbox v-for="(studyhitem,e) in fromLabel.studyhigh" :key="e" :label="studyhitem.attriid" name="studyhigh">{{studyhitem.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item :label-width="formLabelWidth" label="学习英语第三目标-知识：">
                            <el-checkbox-group disabled v-model="form.studyextension">
                                <el-checkbox v-for="(studyexitem,f) in fromLabel.studyextension" :key="f" :label="studyexitem.attriid" name="studyextension">{{studyexitem.attriname}}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.studyshijian">
                                <el-option v-for="(stshiitem,h) in fromLabel.studyshijian" :key="h" :label="stshiitem.attriname" :value="stshiitem.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="预算：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.studymoney">
                                <el-option v-for="(stmitem,i) in fromLabel.studymoney" :key="i" :label="stmitem.attriname" :value="stmitem.attriid"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="学员评测等级：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.level">
                                <el-option v-for="(studylevel,j) in fromLabel.StudentEvaluationGrade" :key="j" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="学员目标等级：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.targetlevel">
                                <el-option v-for="(studylevel,k) in fromLabel.StudentEvaluationGrade" :key="k" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                            <el-input v-model="form.iwant" disabled class="divided_2"></el-input>
                        </el-form-item> 
                        <el-form-item label="学员分组：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.groupid">
                                <el-option v-for="(mgitem,l) in fromLabel.member_group" :key="l" :label="mgitem.name" :value="mgitem.groupid"></el-option>
                            </el-select>
                        </el-form-item>
                        <!-- <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.firstpay" class="divided_2"></el-input>
                        </el-form-item>  -->
                        <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                            <el-input disabled v-model="form.tutorcomment" class="divided_2"></el-input>
                        </el-form-item> 
                        <el-form-item label="学员状态：" :label-width="formLabelWidth">
                            <el-select disabled v-model="form.status" placeholder="选择状态">
                                <el-option v-for="(membersta,s) in fromLabel.memberStatusList" :key="s" :label="membersta.attriname" :value="membersta.attriid"></el-option>
                            </el-select>
                        </el-form-item>   
                    </el-form>
                        <!-- 回访记录 -->
                    <el-tag  class='recordStyle' type="info">回访记录</el-tag>
                    <el-table
                        :data="gotRecord"
                        stripe 
                        size="mini"
                        border resizable
                        style="width: 100%;margin-left:40px;"
                        max-height="656">
                    <el-table-column label="回访时间" :align="align" :width="170">
                            <template slot-scope="scope">{{scope.row.time | transData}}</template>
                        </el-table-column>
                        <el-table-column label="回访内容" :align="align" :width="240">
                            <template slot-scope="scope">{{scope.row.content}}</template>
                        </el-table-column>
                        <el-table-column label="回访人" :align="align" :width="170">
                            <template slot-scope="scope">{{scope.row.agent ? scope.row.agent.realname:''}}</template>
                        </el-table-column>
                        <el-table-column label="回访结果" :align="align" :width="240">
                            <template slot-scope="scope">
                                {{scope.row.lev1}}{{scope.row.lev2?'-':''}}{{scope.row.lev2}}{{scope.row.lev3?'-':''}}{{scope.row.lev3}}
                            </template>
                        </el-table-column>
                    </el-table>
                    <div slot="footer" class="dialog-footer">
                        <el-button class="dialog_close" @click="dialogFormVisibleda = false">关闭</el-button>
                    </div>
                </el-dialog>
                
            </div>

            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_confirm" type="primary" @click="doConfirm">关闭</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import base from '../../api/base.js'
import {formatDate} from '../../../static/js/date.js'
export default {
    props:[
        'classid','classtype','allStudents'
    ],
    data(){
        return{
            userid:'',
            ifchild:'',
            userInfo:[],
            fromLabel:[],
            childData:[],
            //回访记录
            gotRecord:[],
            dialogFormVisibleda:false,//档案


             // 分页数据
            currentPage: 1,
            totalCount:0,
            cur_page:1,
            page_size:9,
            removeid:'',
            form: {
                //  =======================================成人表单数据
                nickname:'',
                new_pwd:'',
                fullname:'',
                mobile:'',
                email:'',
                gender:'',
                face:'',
                daxue:'',
                zhuanye:'',
                gongsi:'',
                job:'',
                zhiwei:'',
                gongsiwangzhi:'',
                gongsidianhua:'',
                lianxiren:'',
                qq:'',
                skypenum:'',
                isfirststudy:'',
                age:'',
                studylevel:'',
                highscore:'',
                province:'',
                cityname:'',
                district:'',
                wanttostudy:[],
                studyhigh:[],
                studyextension:[],
                // studyfrom:[],
                studyshijian: '',
                StudentEvaluationGrade:'',
                level: '',
                targetlevel:'',
                iwant: '',
                groupid:'',
                firstpay:'',
                tutorcomment: '',
                status:'',
                //  =======================================少儿
                username:'',
                regdate:'',
                lastdate:'',
                loginnum:'',
                new_pwd:'',
                // nickname: '',
                mobile:'',
                fullname: '',
                sendmail:'',
                // qq: '',
                // skypenum:'',
                email: '',
                gender:'',
                birthday: '',
                toycartoon:'',
                shoolPeriod: '',//学年
                xuenianid:'',
                grade:'',//年级
                character:'',
                avatar:'',
                // province: '',//省
                // cityname:'',//市
                // district: '',//区
                giftAddr:'',
                studyfrom:[],//学习渠道
                dadname:'',//父亲
                dadmobile:'',
                dadage:'',
                dadjob:'',
                mumname:'',//母亲
                mummobile:'',
                mumage: '',
                mumjob:'',
                familyincome: '',//家庭收入
                alreadystudy:'',
                studytime:'',
                stratway:'',
                withforeign:'',//是否接触其他外教课程
                foreigntime:'',
                schoolname:'',
                englishrank:'',
                englishlevel:'',
                expects:[], 
                improvefields:[],
                considerfield:'',//考虑方面
                weekTime:'',
                suitabletime:[],
                monthbudget:'',
                finishtime:'',
                budget:'',
                appeal:'',
                teachernote:'',
                state:'',
                delivery: false, 
                address:[]
            },
            innerVisible: false,
            // 表格
            formLabelWidth: '160px',
            columWidth:140,
            align:'center',
            // 查询
            formInline: {
                stuname: '',
                stuId:'',
                dialogFormVisible:false
            },
            // 查询结果
            memberList:[],
            addtcBtn:'',
            refreshStu:true
        }
    },
    methods: {
        // 获取回访记录
        getFile(uid,ischild){
            this.dialogFormVisibleda=true;
            this.userid=uid;
            if(ischild==1){
                this.ifchild=true;
            }else{
                this.ifchild=false
            }
            this.getUserInfo()
            this.getRecord()
            this.getAdultform()
            this.getChildform()
        },
        // 获取学员信息
        getUserInfo(){
            this.$axios({
                url: base.baseUrl+"/school/member/get-student-info",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token: localStorage.token,
                    userid:this.userid
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                if(res.data.code==-1){
                    this.alertTip(res.data.msg)
                }else if(res.data.code==200){
                    this.userInfo=res.data.data;
                    // 成人
                    this.form.nickname=this.userInfo.nickname;
                    this.form.fullname=this.userInfo.fullname;
                    this.form.mobile=this.userInfo.mobile;
                    this.form.email=this.userInfo.email;
                    this.form.gender=this.userInfo.memberdetail.gender;
                    this.form.province=this.userInfo.memberdetail.giftprovince;
                    this.form.cityname=this.userInfo.memberdetail.giftcity;
                    this.form.district=this.userInfo.memberdetail.giftdistrict;
                    this.form.address.push(this.userInfo.memberdetail.giftprovince,this.userInfo.memberdetail.giftcity,this.userInfo.memberdetail.giftdistrict);
                    this.form.daxue=this.userInfo.memberdetail.daxue;
                    this.form.gongsi=this.userInfo.memberdetail.gongsi;
                    this.form.job=this.userInfo.memberdetail.job;
                    this.form.zhiwei=this.userInfo.memberdetail.zhiwei;
                    this.form.qq=this.userInfo.memberdetail.qq;
                    this.form.skypenum=this.userInfo.memberdetail.skypenum;
                    this.form.isfirststudy=this.userInfo.memberdetail.isfirststudy;
                    this.form.age=this.userInfo.memberdetail.age;
                    this.form.studyfrom=this.userInfo.memberdetail.studyfrom;
                    this.form.studylevel=this.userInfo.memberdetail.studylevel;
                    this.form.wanttostudy=this.userInfo.memberdetail.wanttostudy;
                    this.form.highscore=this.userInfo.memberdetail.highscore;
                    this.form.studyextension=this.userInfo.memberdetail.studyextension;
                    this.form.studyhigh=this.userInfo.memberdetail.studyhigh;
                    this.form.studyshijian=this.userInfo.memberdetail.studyshijian;        
                    this.form.groupid=this.userInfo.groupid;
                    this.form.targetlevel=this.userInfo.memberdetail.targetlevel;
                    this.form.iwant=this.userInfo.memberdetail.iwant;              
                    this.form.level=this.userInfo.memberdetail.level;
                    this.form.firstpay=this.userInfo.memberdetail.firstpay;
                    this.form.tutorcomment=this.userInfo.memberdetail.tutorcomment;
                    this.form.status=this.userInfo.status;
                    this.form.budget=this.userInfo.memberdetail.budget;

                    //少儿
                    this.form.username=this.userInfo.username;
                    this.form.regdate=this.userInfo.regdate;
                    this.form.lastdate=this.userInfo.lastdate;
                    this.form.loginnum=this.userInfo.loginnum;
                    this.form.sendmail=this.userInfo.sendemail;
                    // this.form.birthday=this.userInfo.memberdetail.birthday;
                    this.form.toycartoon=this.userInfo.memberchild.toycartoon;
                    this.form.grade=this.userInfo.memberchild.grade;
                    this.form.birthday=this.userInfo.memberchild.birthyear+'-'+this.userInfo.memberchild.birthmonth+'-'+this.userInfo.memberchild.birthdate;
                    this.form.character=this.userInfo.memberchild.character;
                    // this.form.address=this.userInfo.memberdetail.giftprovince+'-'+this.userInfo.memberdetail.giftcity+'-'+this.userInfo.memberdetail.giftdistrict;
                    this.form.dadname=this.userInfo.memberchild.dadname;
                    this.form.dadage=this.userInfo.memberchild.dadage;
                    this.form.dadjobs=this.userInfo.memberchild.dadjob;
                    this.form.dadmobile=this.userInfo.memberchild.dadmobile;
                    this.form.mumname=this.userInfo.memberchild.mumname;
                    this.form.mummobile=this.userInfo.memberchild.mummobile;
                    this.form.mumage=this.userInfo.memberchild.mumage;
                    this.form.mumjob=this.userInfo.memberchild.mumjob;
                    this.form.familyincome=this.userInfo.memberchild.familyincome;
                    this.form.alreadystudy=this.userInfo.memberdetail.isfirststudy;
                    this.form.stratway=this.userInfo.memberchild.stratway;
                    this.form.withforeign=this.userInfo.memberchild.withforeign;
                    this.form.studytime=this.userInfo.memberchild.learnedtime;
                    this.form.foreigntime=this.userInfo.memberchild.foreigntime;
                    this.form.schoolname=this.userInfo.memberchild.schoolname;
                    this.form.englishrank=this.userInfo.memberchild.englishrank;
                    this.form.englishlevel=this.userInfo.memberchild.englishlevel;
                    this.form.expects=this.userInfo.memberchild.expect;
                    this.form.improvefields=this.userInfo.memberchild.improvefields;
                    this.form.considerfield=this.userInfo.memberchild.considerfield;
                    this.form.weekTime=this.userInfo.memberchild.weektime;
                    this.form.suitabletime=this.userInfo.memberchild.suitabletime;
                    this.form.monthbudget=this.userInfo.memberchild.monthbudget;
                    this.form.teachernote=this.userInfo.memberdetail.tutorcomment;
                    this.form.finishtime=this.userInfo.memberdetail.studyshijian;
                    this.form.budget=this.userInfo.memberdetail.studymoney;
                    this.form.englishlevel=this.userInfo.memberdetail.studylevel;
                    this.form.appeal=this.userInfo.memberdetail.iwant;
                }else if(res.data.code==-2){
                    this.$router.push('/login')
                }
            });
        },
        // 获取回访记录
        getRecord(){
            this.$axios({
                url: base.baseUrl+"/school/member/get-visit",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token: localStorage.token,
                    userid:this.userid
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                if(res.data.code==200){
                    this.gotRecord=res.data.data
                }
            });
        },
        // 儿童表单
        getChildform(){
            this.$axios({
                url: base.baseUrl+"/school/member/get-student-setting ",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token: localStorage.token,
                    user_role:'child'
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                // console.log(res);
                if(res.data.code==200){
                    this.childData=res.data.data;
                }
            });
        },
        // ==========================================成人
        getAdultform(){
            this.$axios({
                url: base.baseUrl+"/school/member/get-student-setting ",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token: localStorage.token
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                // console.log(res);
                if(res.data.code==200){
                    this.fromLabel=res.data.data;
                }
            });
        },
        handleCurrentChange(val) {
            this.cur_page=val;
            this.searchStu();
        },
        addToBtn(){
            this.innerVisible = true
            this.searchStu()
        },
        handleDelete(index, rows) {
            rows.splice(index, 1);
        },
        searchStu() {
             this.$axios({
                    url: base.baseUrl+"/school/member/get-member-list",
                    method: "POST",
                    header: { 'content-type': 'application/x-www-form-urlencoded' },
                    data:{
                        token:localStorage.token,
                        username_kw:this.formInline.stuId,//15252329289
                        // username_kw:15252329289,
                        classType:this.classtype,
                        nickname_kw:this.formInline.stuname,
                        p:this.cur_page,
                        page_size:this.page_size
                    },
                    transformRequest: [function (data) {
                        let ret = ''
                        for (let it in data) {
                            ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                        }
                        return ret
                    }],
                }).then(res => {
                    // console.log(res);
                    if(res.data.code==-1){
                        this.alertTip(res.data.msg)
                    }else if(res.data.code==200){
                        this.memberList=res.data.data.member_list; 
                        this.totalCount=Number(res.data.data.pages.total_count);
                        // this.ifJoin()
                    }else if(res.data.code==-2){
                        this.$router.push('/login');
                    }
                      
                });
        },
        ifJoin(sid){
            if(this.allStudents){
               for(var index in this.allStudents){
                    if(this.allStudents.indexOf(String(sid))==-1){
                        return true
                    }else{
                        return false
                    }
                } 
            }else{
                return true
            }
            
        },
        //添加学员
        submitAdd(stuid){
            this.$axios({
                url: base.baseUrl+"/school/class/add-students-to-class",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token:localStorage.token,
                    classid:this.classid,
                    studentid:stuid
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                if(res.data.code==-1){
                    this.alertTip(res.data.msg)
                }else if(res.data.code==200){
                    this.alertTip('添加成功')
                    this.refreshStu=true
                    this.$emit('refreshList',this.refreshStu);
                    this.searchStu()
                }
            });
        },
        toMove(rid){
            this.removeid=rid
            this.$alert('是否将学员移出班级', '提示', {
                confirmButtonText: '确定',
                callback: action => {
                    this.outClass()
                }
            });
        },
        //移出班级
        outClass(){
            this.$axios({
                url: base.baseUrl+"/school/class/del-students-to-class",
                method: "POST",
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                data:{
                    token:localStorage.token,
                    class_id:this.classid,
                    student_id:this.removeid,
                },
                transformRequest: [function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    return ret
                }],
            }).then(res => {
                if(res.data.code==-1){
                    this.alertTip(res.data.msg)
                }else if(res.data.code==200){
                    this.alertTip('移出成功')
                    this.refreshStu=true
                    this.$emit('refreshList',this.refreshStu);
                    this.searchStu()
                }
            });
        },
        doConfirm(){
            this.refreshStu=false
            this.$emit('refreshList',this.refreshStu);
            this.innerVisible = false
        },
        alertTip(msg){
            this.$alert(msg, '提示', {
                confirmButtonText: '确定',
                callback: action => {
                    this.$message({
                        type: 'info',
                    });
                }
            });
        }
    },
    filters:{
        transData(time){
            return formatDate(new Date(time * 1000), 'yyyy-MM-dd hh:mm');
        },
        
    }
}
</script>
<style lang="less" scoped>
    .recordStyle{
        width: 100%;
        text-align: center;
        margin: 10px 0 30px 40px;
    }
    .operate_inputs{
        padding: 15px 30px;
        height: 70px;
        box-sizing: border-box;
        button{
            width: 130px;
            height: 38px;
            border-radius: 4px;
            border: none;
        }
        .search_btn{       
            background-color: #ff5263;
        }
        .reset_btn{
            background-color: #808080;
        }
    }
    .page_block2{
        margin-top:12px;
        text-align: right;
    }
</style>


